package com.thomas.thread;

/**   
* @Description: TODO(用一句话描述该文件做什么) 
* @author thomas_liu  
* @date 2018年5月11日 下午3:09:24 
* @version V1.0   
*/
public class NoVisibility {
	
	private static boolean ready;
	
	private static int number;
	
	
	private static class ReaderThread extends Thread{
		public void run(){
			while(!ready){
				Thread.yield();
				System.out.println(number);
			}
		}
	}
	
	
	
	public static void main(String[] args) {
		new ReaderThread().start();
		number = 42;
		ready = true;
	}
	

}
